Fix cut and paste typo where wrong pixmap was being unref'ed. (Pointed out
authorOwen Taylor <otaylor@redhat.com>
Sun, 11 Jun 2000 18:06:04 +0000 (18:06 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sun, 11 Jun 2000 18:06:04 +0000 (18:06 +0000)
Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
cut and paste typo where wrong pixmap was being
unref'ed. (Pointed out by a friend of KUSANO Takayuki.)

Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>

* gtk/gtkselection.c (gtk_selection_bytes_per_item):
Add helper function to compute format / bytes
relationship. Use in a couple places to fix up
errors which assume 8 * format.

* gtk/gtkselection.c (gtk_selection_request): Use 32
rather than 8 * sizeof (GdkAtom), to work correctly
on Alpha.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkdnd.c
gtk/gtkselection.c

index 73673257db00a735d707d78d18f6f9d6ad8fd4d6..60be66d1ba5219f4fcedd91b043977d8613a816d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,24 @@
-Thu Jun  8 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Save cflags for all backends, not just X11.
+Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>
 
-Wed Jun  7 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Use $PANGO_CONFIG instead of pango-config
+       * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
+       cut and paste typo where wrong pixmap was being
+       unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
+
+Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkselection.c (gtk_selection_bytes_per_item):
+       Add helper function to compute format / bytes 
+       relationship. Use in a couple places to fix up
+       errors which assume 8 * format.
+
+       * gtk/gtkselection.c (gtk_selection_request): Use 32
+       rather than 8 * sizeof (GdkAtom), to work correctly
+       on Alpha.
 
 Wed Jun  7 15:44:42 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
-       GTK+ from even building at all
+       GTK+ from building at all.
 
        * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.
 
index 73673257db00a735d707d78d18f6f9d6ad8fd4d6..60be66d1ba5219f4fcedd91b043977d8613a816d 100644 (file)
@@ -1,13 +1,24 @@
-Thu Jun  8 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Save cflags for all backends, not just X11.
+Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>
 
-Wed Jun  7 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Use $PANGO_CONFIG instead of pango-config
+       * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
+       cut and paste typo where wrong pixmap was being
+       unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
+
+Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkselection.c (gtk_selection_bytes_per_item):
+       Add helper function to compute format / bytes 
+       relationship. Use in a couple places to fix up
+       errors which assume 8 * format.
+
+       * gtk/gtkselection.c (gtk_selection_request): Use 32
+       rather than 8 * sizeof (GdkAtom), to work correctly
+       on Alpha.
 
 Wed Jun  7 15:44:42 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
-       GTK+ from even building at all
+       GTK+ from building at all.
 
        * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.
 
index 73673257db00a735d707d78d18f6f9d6ad8fd4d6..60be66d1ba5219f4fcedd91b043977d8613a816d 100644 (file)
@@ -1,13 +1,24 @@
-Thu Jun  8 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Save cflags for all backends, not just X11.
+Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>
 
-Wed Jun  7 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Use $PANGO_CONFIG instead of pango-config
+       * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
+       cut and paste typo where wrong pixmap was being
+       unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
+
+Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkselection.c (gtk_selection_bytes_per_item):
+       Add helper function to compute format / bytes 
+       relationship. Use in a couple places to fix up
+       errors which assume 8 * format.
+
+       * gtk/gtkselection.c (gtk_selection_request): Use 32
+       rather than 8 * sizeof (GdkAtom), to work correctly
+       on Alpha.
 
 Wed Jun  7 15:44:42 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
-       GTK+ from even building at all
+       GTK+ from building at all.
 
        * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.
 
index 73673257db00a735d707d78d18f6f9d6ad8fd4d6..60be66d1ba5219f4fcedd91b043977d8613a816d 100644 (file)
@@ -1,13 +1,24 @@
-Thu Jun  8 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Save cflags for all backends, not just X11.
+Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>
 
-Wed Jun  7 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Use $PANGO_CONFIG instead of pango-config
+       * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
+       cut and paste typo where wrong pixmap was being
+       unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
+
+Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkselection.c (gtk_selection_bytes_per_item):
+       Add helper function to compute format / bytes 
+       relationship. Use in a couple places to fix up
+       errors which assume 8 * format.
+
+       * gtk/gtkselection.c (gtk_selection_request): Use 32
+       rather than 8 * sizeof (GdkAtom), to work correctly
+       on Alpha.
 
 Wed Jun  7 15:44:42 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
-       GTK+ from even building at all
+       GTK+ from building at all.
 
        * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.
 
index 73673257db00a735d707d78d18f6f9d6ad8fd4d6..60be66d1ba5219f4fcedd91b043977d8613a816d 100644 (file)
@@ -1,13 +1,24 @@
-Thu Jun  8 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Save cflags for all backends, not just X11.
+Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>
 
-Wed Jun  7 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Use $PANGO_CONFIG instead of pango-config
+       * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
+       cut and paste typo where wrong pixmap was being
+       unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
+
+Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkselection.c (gtk_selection_bytes_per_item):
+       Add helper function to compute format / bytes 
+       relationship. Use in a couple places to fix up
+       errors which assume 8 * format.
+
+       * gtk/gtkselection.c (gtk_selection_request): Use 32
+       rather than 8 * sizeof (GdkAtom), to work correctly
+       on Alpha.
 
 Wed Jun  7 15:44:42 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
-       GTK+ from even building at all
+       GTK+ from building at all.
 
        * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.
 
index 73673257db00a735d707d78d18f6f9d6ad8fd4d6..60be66d1ba5219f4fcedd91b043977d8613a816d 100644 (file)
@@ -1,13 +1,24 @@
-Thu Jun  8 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Save cflags for all backends, not just X11.
+Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>
 
-Wed Jun  7 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Use $PANGO_CONFIG instead of pango-config
+       * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
+       cut and paste typo where wrong pixmap was being
+       unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
+
+Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkselection.c (gtk_selection_bytes_per_item):
+       Add helper function to compute format / bytes 
+       relationship. Use in a couple places to fix up
+       errors which assume 8 * format.
+
+       * gtk/gtkselection.c (gtk_selection_request): Use 32
+       rather than 8 * sizeof (GdkAtom), to work correctly
+       on Alpha.
 
 Wed Jun  7 15:44:42 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
-       GTK+ from even building at all
+       GTK+ from building at all.
 
        * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.
 
index 73673257db00a735d707d78d18f6f9d6ad8fd4d6..60be66d1ba5219f4fcedd91b043977d8613a816d 100644 (file)
@@ -1,13 +1,24 @@
-Thu Jun  8 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Save cflags for all backends, not just X11.
+Sun Jun 11 12:46:19 2000  Owen Taylor  <otaylor@redhat.com>
 
-Wed Jun  7 15:44:42 2000  Elliot Lee <sopwith@redhat.com>
-       * configure.in: Use $PANGO_CONFIG instead of pango-config
+       * gtk/gtkdnd.c (gtk_drag_set_default_icon): Fix
+       cut and paste typo where wrong pixmap was being
+       unref'ed. (Pointed out by a friend of KUSANO Takayuki.)
+
+Sun Jun 11 10:22:36 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkselection.c (gtk_selection_bytes_per_item):
+       Add helper function to compute format / bytes 
+       relationship. Use in a couple places to fix up
+       errors which assume 8 * format.
+
+       * gtk/gtkselection.c (gtk_selection_request): Use 32
+       rather than 8 * sizeof (GdkAtom), to work correctly
+       on Alpha.
 
 Wed Jun  7 15:44:42 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gtk/Makefile.am (LDFLAGS): Add missing backslash that was keeping
-       GTK+ from even building at all
+       GTK+ from building at all.
 
        * gdk/Makefile.am (gdk_c_sources): Fix up some indentation issues.
 
index 74e40352e63c98890c5b0d8bfb8266bb8750fd92..e00fa7d59f10fdf6a69bfb42f66ec74dad3e28e0 100644 (file)
@@ -2065,7 +2065,7 @@ gtk_drag_set_default_icon (GdkColormap   *colormap,
   if (default_icon_pixmap)
     gdk_pixmap_unref (default_icon_pixmap);
   if (default_icon_mask)
-    gdk_pixmap_unref (default_icon_pixmap);
+    gdk_pixmap_unref (default_icon_mask);
 
   default_icon_colormap = colormap;
   gdk_colormap_ref (colormap);
index 2bfbf95ed0044b67b84ebe034df8e5598b17e3a4..c443282e90fdaa726399c3e403109a30304df8d5 100644 (file)
@@ -139,18 +139,21 @@ struct _GtkRetrievalInfo
 };
 
 /* Local Functions */
-static void gtk_selection_init                  (void);
-static gint gtk_selection_incr_timeout          (GtkIncrInfo *info);
-static gint gtk_selection_retrieval_timeout     (GtkRetrievalInfo *info);
-static void gtk_selection_retrieval_report      (GtkRetrievalInfo *info,
-                                                 GdkAtom type, gint format, 
-                                                 guchar *buffer, gint length,
-                                                 guint32 time);
-static void gtk_selection_invoke_handler        (GtkWidget        *widget,
-                                                 GtkSelectionData *data,
-                                                 guint             time);
-static void gtk_selection_default_handler       (GtkWidget       *widget,
-                                                 GtkSelectionData *data);
+static void gtk_selection_init              (void);
+static gint gtk_selection_incr_timeout      (GtkIncrInfo      *info);
+static gint gtk_selection_retrieval_timeout (GtkRetrievalInfo *info);
+static void gtk_selection_retrieval_report  (GtkRetrievalInfo *info,
+                                            GdkAtom           type,
+                                            gint              format,
+                                            guchar           *buffer,
+                                            gint              length,
+                                            guint32           time);
+static void gtk_selection_invoke_handler    (GtkWidget        *widget,
+                                            GtkSelectionData *data,
+                                            guint             time);
+static void gtk_selection_default_handler   (GtkWidget        *widget,
+                                            GtkSelectionData *data);
+static int  gtk_selection_bytes_per_item    (gint              format);
 
 /* Local Data */
 static gint initialize = TRUE;
@@ -891,7 +894,7 @@ gtk_selection_request (GtkWidget *widget,
   for (i=0; i<info->num_conversions; i++)
     {
       GtkSelectionData data;
-      gint items;
+      glong items;
       
       data.selection = event->selection;
       data.target = info->conversions[i].target;
@@ -916,7 +919,7 @@ gtk_selection_request (GtkWidget *widget,
       
       g_return_val_if_fail ((data.format >= 8) && (data.format % 8 == 0), FALSE);
       
-      items = (data.length + data.format/8 - 1) / (data.format/8);
+      items = data.length / gtk_selection_bytes_per_item (data.format);
       
       if (data.length > GTK_SELECTION_MAX_SIZE)
        {
@@ -929,7 +932,7 @@ gtk_selection_request (GtkWidget *widget,
          gdk_property_change (info->requestor, 
                               info->conversions[i].property,
                               gtk_selection_atoms[INCR],
-                              8*sizeof (GdkAtom),
+                              32,
                               GDK_PROP_MODE_REPLACE,
                               (guchar *)&items, 1);
        }
@@ -972,7 +975,7 @@ gtk_selection_request (GtkWidget *widget,
   if (event->target == gtk_selection_atoms[MULTIPLE])
     {
       gdk_property_change (info->requestor, event->property,
-                          GDK_SELECTION_TYPE_ATOM, 8*sizeof(GdkAtom)
+                          GDK_SELECTION_TYPE_ATOM, 32
                           GDK_PROP_MODE_REPLACE,
                           mult_atoms, 2*info->num_conversions);
       g_free (mult_atoms);
@@ -1053,6 +1056,8 @@ gtk_selection_incr_event (GdkWindow          *window,
       if (info->conversions[i].property == event->atom &&
          info->conversions[i].offset != -1)
        {
+         int bytes_per_item;
+         
          info->idle_time = 0;
          
          if (info->conversions[i].offset == -2) /* only the last 0-length
@@ -1081,13 +1086,14 @@ gtk_selection_incr_event (GdkWindow        *window,
                     num_bytes, info->conversions[i].offset, 
                     GDK_WINDOW_XWINDOW(info->requestor), event->atom);
 #endif
+
+         bytes_per_item = gtk_selection_bytes_per_item (info->conversions[i].data.format);
          gdk_property_change (info->requestor, event->atom,
                               info->conversions[i].data.type,
                               info->conversions[i].data.format,
                               GDK_PROP_MODE_REPLACE,
-                              buffer, 
-                              (num_bytes + info->conversions[i].data.format/8 - 1) / 
-                              (info->conversions[i].data.format/8));
+                              buffer,
+                              num_bytes / bytes_per_item);
          
          if (info->conversions[i].offset == -2)
            {
@@ -1517,11 +1523,13 @@ gtk_selection_default_handler (GtkWidget        *widget,
          if ((selection_info->widget == widget) &&
              (selection_info->selection == data->selection))
            {
+             gulong time = selection_info->time;
+
              gtk_selection_data_set (data,
                                      GDK_SELECTION_TYPE_INTEGER,
-                                     sizeof (guint32)*8,
-                                     (guchar *)&selection_info->time,
-                                     sizeof (guint32));
+                                     32,
+                                     (guchar *)&time,
+                                     sizeof (time));
              return;
            }
          
@@ -1544,7 +1552,7 @@ gtk_selection_default_handler (GtkWidget  *widget,
       count = g_list_length (target_list->list) + 3;
       
       data->type = GDK_SELECTION_TYPE_ATOM;
-      data->format = 8*sizeof (GdkAtom);
+      data->format = 32;
       data->length = count * sizeof (GdkAtom);
       
       p = g_new (GdkAtom, count);
@@ -1590,3 +1598,23 @@ gtk_selection_data_free (GtkSelectionData *data)
   
   g_free (data);
 }
+
+static int 
+gtk_selection_bytes_per_item (gint format)
+{
+  switch (format)
+    {
+    case 8:
+      return sizeof (char);
+      break;
+    case 16:
+      return sizeof (short);
+      break;
+    case 32:
+      return sizeof (long);
+      break;
+    default:
+      g_assert_not_reached();
+    }
+  return 0;
+}